package com.longge;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-05-04 01:45
 */
public class NumberOfMatches {

    public int numberOfMatches(int n) {
        if (n == 1) return 0;
        int son = n % 2 == 0 ? n / 2 : (n - 1) / 2 + 1;
        int d = numberOfMatches(son);
        return n / 2  + d;
    }
}
